#!/usr/bin/python

import sys
import math
import networkx


# Basically this file is just a wrapper around the graph generator
# networkx.generators.random_graphs.powerlaw_cluster_graph.
# Output is to standard out (so use pipe redirection)


def main():
	# usage: graph_gen.py n m p seed > outputfile
	if ( len(sys.argv) != 5 ):
		print("usage: graph_gen.py n m p seed > outputfile")
		return

	n = int(float(sys.argv[1])) 
	m = int(sys.argv[2])
	p = float(sys.argv[3])
	s = int(sys.argv[4])

	G = networkx.Graph()
	networkx.generators.random_graphs.powerlaw_cluster_graph(n,m,p,G,s)

	networkx.readwrite.edgelist.write_edgelist(G, sys.stdout, data=False)

if __name__ == '__main__':
	main()
